import request from "@/utils/request";

// 获取菜品管理信息
export function getDishes(params) {
  return request({
    url: "dish/page",
    method: "get",
    params,
  });
}

export function getCategoryName() {
  return request({
    url: "category/list?type=1",
    method: "get",
  });
}

export function addDishes(data) {
  return request({
    url: "/dish",
    method: "post",
    data,
  });
}

export function addDishesImage(data) {
  return request({
    url: "common/upload",
    method: "post",
    data,
  });
}

export function editDishes(data) {
  return request({
    url: "/dish",
    method: "put",
    data,
  });
}

export function getDishesById(id) {
  return request({
    url: `/dish/${id}`,
    method: "get",
  });
}

export function changeDishesStatus(status, params) {
  return request({
    url: `/dish/status/${status}`,
    method: "post",
    params,
  });
}

export function deleteDishes(params) {
  return request({
    url: `/dish`,
    method: "delete",
    params,
  });
}
